package com.briup.recognition.service.impl;

import com.briup.recognition.bean.Dataset;
import com.briup.recognition.bean.DatasetExample;
import com.briup.recognition.dao.DatasetMapper;
import com.briup.recognition.service.IDatasetService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: recognition
 * @description:
 * @author: charles
 * @create: 2021-03-28 15:11
 **/

@Service
public class DatasetServiceImpl implements IDatasetService {

    @Resource
    private DatasetMapper datasetMapper;

    @Override
    public List<Dataset> query() {
        DatasetExample example = new DatasetExample();
        // 条件

        return datasetMapper.selectByExample(example);
    }

    @Override
    public void saveOrUpdate(Dataset dataset) {
        if(dataset.getId()!=null){
            datasetMapper.updateByPrimaryKey(dataset);
        } else {
            datasetMapper.insert(dataset);
        }
    }

    @Override
    public void deleteById(long id) {
        datasetMapper.deleteByPrimaryKey(id);
    }
}